#include <stdio.h>
#include <unistd.h>
#include <cstdlib>
#include <sys/wait.h>

int main()
{
	int pid;
	/* fork child process */
	pid = fork();
	switch(pid) {
		case -1:
			perror("fork failed");
			exit(1);
		case 0: // child process
			execl("/bin/ls", "ls", "-l", "--color", NULL);
			perror("execl failed");
			exit(1);
		default: // father process
			wait(NULL);
			printf("ls completed\n");
			exit(0);
	}
}
